package File;

public class ListFilesDemo {
    public static void main(String[] args)
    {
        String path=".";
        File file=new File(path);
        File [] files=file.listFiles();
        for(File f:files)
        {
            System.out.println(f.getName());
        }

        File[] files=file.listFiles(new FileFilter() {
            public boolean accept(File pathname)
            {
                return pathname.getName().endsWith(".java");
            }
        });

        files=file.listFile(f->f.isFile()&&f.getName().endsWith(".java"));
        for(File f:files)
        {
            System.out.println(f.getName());
        }

    }
}
